package com.fkcai.hansoul.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fkcai.hansoul.model.dto.post.PostCategoryTwoDto;
import com.fkcai.hansoul.model.entity.PostCategoryTwo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PostCategoryTwoMapper extends BaseMapper<PostCategoryTwo> {
	@Select("SELECT c2.category_id AS categoryId, " +
			"c2.category_name AS categoryName, " +
			"c1.category_name AS parentCategoryName " +
			"FROM post_category_two c2 LEFT JOIN  post_category_one c1 " +
			"ON c2.parent_category_id = c1.category_id " +
			"ORDER BY c1.category_id" )
	List<PostCategoryTwoDto> selectAllPostCategoriesTwo();
}
